﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Vowei.Core.Models;
using Vowei.Web;

namespace vowei.web.Controllers
{
    public class ResourceController : G18nController
    {
        private IVoweiContext _context;
        private IUser _user;

        public ResourceController(IVoweiContext context, IUser user)
        {
            _context = context;
            _user = user;
        }

        public ActionResult Index()
        {
            var calendars = _context.ResourceCalendars.Query.ToArray();
            return View(calendars);
        }

        public ActionResult Details(Guid id)
        {
            var calendar = _context.ResourceCalendars.Find(id);
            if (calendar == null)
                throw new InvalidOperationException(string.Format(T("找不到id为 [{0}] 的资源工时日历！"), id));

            return View(calendar);
        }

        public ActionResult Create()
        {
            return View();
        }
    }
}
